package com.jeasonzhao.commons.basic;

public class TimePointer
{
    private long m_long = -1;
    private boolean m_bAutoReset;
    public TimePointer(boolean bAutoRet)
    {
        m_bAutoReset = bAutoRet;
        begin();
    }

    public long getMilliSecondes()
    {
        long ret = System.currentTimeMillis() - m_long;
        if(m_bAutoReset)
        {
            begin();
        }
        return ret;
    }

    public void reset()
    {
        begin();
    }

    public long getSecondes()
    {
        return getMilliSecondes() / 1000;
    }

    public long getMinutes()
    {
        return getMilliSecondes() / 1000 / 60;
    }

    public long getHours()
    {
        return getMilliSecondes() / 1000 / 60 / 60;
    }

    public void begin()
    {
        m_long = System.currentTimeMillis();
    }

}
